<?php

class Maillist_Model_SubscribersPostsMapper{
	protected $_dbTable;
	
	public function setDbTable($dbTable)
    {
        if (is_string($dbTable)) {
            $dbTable = new $dbTable();
        }
        if (!$dbTable instanceof Zend_Db_Table_Abstract) {
            throw new Exception('Invalid table data gateway provided');
        }
        $this->_dbTable = $dbTable;
        return $this;
    }

    public function getDbTable(){
        if (null === $this->_dbTable)
            $this->setDbTable('Maillist_Model_DbTable_SubscribersPosts');
        return $this->_dbTable;
    }
    
    public function save($params){
        $t = $this->getDbTable();
        unset($params['Id']);
        return $t->insert($params);
    }
    
    public function delete($id){
        $this->getDbTable()->delete(array('Id=?'=>$id));
    }
}
?>